<template>
    <div class="Achievements">
        <!-- 绩效之星 -->
        <box-group-wrap pageTitle="绩效之星" :isShowData="isShowData">
            <template slot="wrapBody">
                <div class="wrapachievemnt">
                    <el-table :data="dataList" stripe style="width:100%" class="heard-bg">
                        <el-table-column label="月份">
                            <template slot-scope="scope">
                                <div class="text_red">{{scope.row.month | dataFilter}}</div>
                            </template>
                        </el-table-column>
                        <el-table-column label="姓名" prop="staffName"></el-table-column>"score": 98
                        <el-table-column label="绩效分" prop="score">
                            <template slot-scope="scope">
                                <div class="text_red">{{scope.row.score | filteScoreNum}}</div>
                            </template>
                        </el-table-column>
                        <el-table-column label="组别" prop="staffGroup"></el-table-column>
                    </el-table>
                </div>
            </template>
        </box-group-wrap>
    </div>
</template>
<script>
import { mapGetters } from 'vuex';
import moment from 'moment'
import BoxGroupWrap from '@/components/boxgroupwrap/BoxGroupWrap.vue';

export default {
    name: 'Achievements',
    data() {
        return {
            isShowData: true,
            dataList: [],
        }
    },
    components: { 'box-group-wrap': BoxGroupWrap, },
    filters: {
        dataFilter(value) {
            if (value) {
                let mouth = moment(value).format('MM');
                let yaers = moment(value).format('YY');
                return yaers + '年' + mouth + '月'
            }
        },
        filteScoreNum: (value) => {
            if (value) {
                return value.toFixed(2);
            } else {
                return '';
            }
        }
    },
    mounted() {
        this.getdataList();
    },
    methods: {
        // 获取绩效之星 数据
        async getdataList() {
            let params = {
                time: moment().format('YYYY-MM') + '-01',
            };
            // console.log('params_____________11111', params);
            await this.$post.homePage.PerformanceStar(params).then((res) => {
                if (res.data.success) {
                    this.isShowData = true;
                    console.log('绩效之星___1', res);
                    this.dataList = res.data.content;
                    console.log('memoData__有数据了', this.memoData);
                }
            });
        },
    },
}
</script>
<style lang="scss">
.Achievements {
    .wrapachievemnt {
        /* 表头 */
        .el-table__header-wrapper .el-table__header thead tr th {
            padding: 6px 0;
        }
        /* 表内容 */
        .el-table__body-wrapper .el-table__body tbody tr td {
            padding: 1px 0;
        }
    }
}
</style>
<style scoped lang="scss">
.Achievements {
    .wrapachievemnt {
        .text_red {
            color: #ff2d2d;
        }
    }
}
</style>